class Solution
{
public:
    int distributeCandies(vector<int> &candyType)
    {
        int typeCount = unordered_set<int>(candyType.begin(), candyType.end()).size();
        return typeCount <= candyType.size() / 2 ? typeCount : candyType.size() / 2;
    }
};